package discovery

import (
	"context"

	"gitee.com/mkwchecking/k-scaffold/config"

	"gitee.com/mkwchecking/k-scaffold/pkg/rely/ctx"
)

// Provide service discovery
func Provide(ctx context.Context, conf config.Discovery) (Discovery, error) {
	return New(ctx, conf)
}

func GetDiscovery(c context.Context) (Discovery, error) {
	val, err := ctx.Get[Discovery](c, ctx.DiscoveryKey{})
	return val, err
}
